package model.gamemenu;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;

public class GameMenu {
	protected ItemList itemList;
	
	/** Construct a new game menu */
	public GameMenu() {
		this.itemList = new ItemList(); 
	}
	
	/** Handles keyboard input */
	public void keyPressHandler(KeyEvent e) {	
		switch (e.getKeyCode()) {
			case KeyEvent.VK_UP:
				this.itemList.scrollUp();
				break;
			case KeyEvent.VK_DOWN:
				this.itemList.scrollDown();
				break;
			default:
				break;
		}
	}
	
	/** Handles mouse input */
	public void mouseClickedHandler(MouseEvent e) {
	}
	
	/** Updates the game menu */
	public void update(double delta) {
	}
	
	/** Draws the game menu */
	public void draw(Graphics2D g) {
		// Get original graphics values
		Color color = g.getColor();
		Font font = g.getFont();
		
		// Enable anti aliasing for text
	    g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
	    		RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
		
		// Draw menu
	    String mode = this.itemList.getCurrentItem().toString();
	    g.setColor(Color.WHITE);
		g.drawString(mode, 50, 50);
		
		// Restore original graphics values
		g.setColor(color);
		g.setFont(font);
	}
}
